/**
 * [getComicType 获取漫画分类]
 * 不设置父类即在全部子类里搜索，否则在限定类型里搜索
 * 全部子类里搜索:
 *   "0,2,28,3,6,9,8,2," —->> [{"id":28,"name":"知音漫客"},{"id":3:name:"搞笑"}]
 * 限定类(fatherid为1)：
 *   "0,2,28,3,6,9,8,2," —->> [{"id":3:name:"搞笑"}]
 * @param {[type]} classify [获取公共分类]
 * @param {[string]} idList id参数序列  1,2,3,4
 * @param {[number]} fatherId fatherId 待过滤的fatherId 1234
 */
export function getComicType(classify, idList, fatherId) {
    const _this = this;

    try {
        let tmpAarr = [],
            ids = _this.toStr(idList).trim().replaceStarEndChar(',', ''); //去除前后限定符x

        if (ids.length === 0 || !classify) {
            throw Error('传入classify或idList不合法!');
        }
        const tmpAry = ids.split(',');

        fatherId = _this.toInt(fatherId);
        tmpAry.forEach(function (v) {
            const intV = _this.toInt(v);

            if (classify[intV] === undefined || classify[intV].father === 0) { // 排除父类(father为0)
                return;
            }
            if (fatherId && classify[intV].father !== fatherId) { // 判断是否设置在限定子类里搜索
                return;
            }
            tmpAarr.push({
                id: intV,
                name: classify[intV].name
            });
        });

        return tmpAarr;
    } catch (e) {
        return e;
    }
}